package com.tulei.admin.controller;


import com.tulei.common.response.R;
import com.tulei.common.utils.StringUtils;
import com.tulei.system.Entity.SysDictData;
import com.tulei.system.service.DictDataService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;


/**
 * @Author TuLei
 * @Date 2024-06-17 12:29
 **/

@RequiredArgsConstructor
@RestController
@RequestMapping("/api/dict/data")
public class SysDictDataController {



    private final DictDataService dictTypeService;



    @GetMapping(value = "/type/{dictType}")
    public R<List<SysDictData>> dictType(@PathVariable String dictType)
    {
        List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
        if (StringUtils.isNull(data))
        {
            data = new ArrayList<SysDictData>();
        }
        return R.ok(data);
    }

}
